/**
 * 
 * @param {    isHidden: { type: Boolean, default: false },
    iotId: { type: String },
    reportTime:{type:Date},
    dqaTime:{type:Number},
    deviceSecret: { type: String },
    productKey: { type: String },
    deviceName: { type: String },
    videoUrl: { type: String },
    devices: { type: Array },
    type: { type: String, default: "Gateway" },
    outAdult: { type: Number },
    alarm: { type: Number },
    inBaby: { type: Number },
    inAdult: { type: Number },
    countTime: { type: Number },
    battery: { type: Number },
    items: { type: Object }} jsonData 
 * @returns 
 */
let moment = require('moment')

const dataTransferToStatement = (jsonData)=>{
    let array = []
    if(jsonData){
        for(let key in jsonData){
            let items = jsonData[key]
            let countTime = moment(key,"YYYYMMDDHHmmss").valueOf()
            let item = {
                items,
                countTime,
                inBaby:items && items.inBaby,
                inAdult:items && items.inAdult,
                outAdult:items && items.outAdult,
                outBaby:items && items.outBaby,
                alarm:items && items.alarm || 0,
                videoUrl:items && items.src_video,
                battery:100,
                deviceName:"camera-003",
                deviceType:"camera",
                iotId:"MS5PvBVc3VwyoD124GZB000000"
            }
            array.push(item)
        }
    }
    return array
}

module.exports = {
    dataTransferToStatement
}